!pip install dash
Requirement already satisfied: dash in /usr/local/lib/python3.9/site-packages (2.7.1) Requirement already satisfied: dash-table==5.0.0 in /usr/local/lib/python3.9/site-packages (from dash) (5.0.0) Requirement already satisfied: plotly>=5.0.0 in /usr/local/lib/python3.9/site-packages (from dash) (5.11.0) Requirement already satisfied: Flask>=1.0.4 in /usr/local/lib/python3.9/site-packages (from dash) (2.1.3) Requirement already satisfied: dash-html-components==2.0.0 in /usr/local/lib/python3.9/site-packages (from dash) (2.0.0) Requirement already satisfied: dash-core-components==2.0.0 in /usr/local/lib/python3.9/site-packages (from dash) (2.0.0) Requirement already satisfied: Werkzeug>=2.0 in /usr/local/lib/python3.9/site-packages (from Flask>=1.0.4->dash) (2.0.3) Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.9/site-packages (from Flask>=1.0.4->dash) (3.1.2) Requirement already satisfied: click>=8.0 in /usr/local/lib/python3.9/site-packages (from Flask>=1.0.4->dash) (8.1.3) Requirement already satisfied: itsdangerous>=2.0 in /usr/local/lib/python3.9/site-packages (from Flask>=1.0.4->dash) (2.0.1) Requirement already satisfied: importlib-metadata>=3.6.0 in /usr/local/lib/python3.9/site-packages (from Flask>=1.0.4->dash) (5.1.0) Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.9/site-packages (from plotly>=5.0.0->dash) (8.1.0) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/site-packages (from importlib-metadata>=3.6.0->Flask>=1.0.4->dash) (3.11.0) Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.9/site-packages (from Jinja2>=3.0->Flask>=1.0.4->dash) (2.0.1) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
from interpret.ext.blackbox import *
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
import pandas as pd
import joblib
X_train = pd.read_csv("/ml_data/X_train.csv").drop(columns = "Unnamed: 0")
y_train = pd.read_csv("/ml_data/y_train.csv").drop(columns = "Unnamed: 0")
X_test = pd.read_csv("/ml_data/X_test.csv").drop(columns = "Unnamed: 0")
y_test = pd.read_csv("/ml_data/y_test.csv").drop(columns = "Unnamed: 0")
model = joblib.load("/artifact/mlruns/941649382202349625/a8b85d3a1dc54222970863c0c4298e58/artifacts/model/model.pkl")
explainer = PFIExplainer(model,
features = X_train.columns,
classes = y_test["quality"].unique())
explainer = TabularExplainer(model,
X_train,
features = X_train.columns,
classes = y_test["quality"].unique())
# explain overall model predictions (global explanation)
global_explanation = explainer.explain_global(X_test)
Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
0%| | 0/272 [00:00<?, ?it/s]
Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
from raiwidgets import ExplanationDashboard
ExplanationDashboard(global_explanation, model, dataset=X_test, true_y=y_test,port = 5599, public_ip="0.0.0.0")
Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
Interpret started at http://0.0.0.0:5599
<raiwidgets.explanation_dashboard.ExplanationDashboard at 0x7f5f52592fa0>
import pandas as pd
import joblib
X_train = pd.read_csv("/ml_data/X_train.csv").drop(columns = "Unnamed: 0")
y_train = pd.read_csv("/ml_data/y_train.csv").drop(columns = "Unnamed: 0")
X_test = pd.read_csv("/ml_data/X_test.csv").drop(columns = "Unnamed: 0")
y_test = pd.read_csv("/ml_data/y_test.csv").drop(columns = "Unnamed: 0")
model = joblib.load("/artifact/mlruns/661781806827710659/572147d429ba41aea8b635c3b57042aa/artifacts/model/model.pkl")
explainer = PFIExplainer(model,
features = X_train.columns,
classes = y_test["quality"].unique())
from raiwidgets import ExplanationDashboard
ExplanationDashboard(global_explanation, model, dataset=X_test, true_y=y_test,port = 5599, public_ip="0.0.0.0")
Exception in thread Thread-10:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.9/threading.py", line 917, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.9/site-packages/rai_core_flask/flask_helper.py", line 104, in run
self.server.serve_forever()
File "/usr/local/lib/python3.9/site-packages/gevent/baseserver.py", line 398, in serve_forever
self.start()
File "/usr/local/lib/python3.9/site-packages/gevent/baseserver.py", line 336, in start
self.init_socket()
File "/usr/local/lib/python3.9/site-packages/gevent/pywsgi.py", line 1545, in init_socket
Interpret started at http://0.0.0.0:5599
StreamServer.init_socket(self)
File "/usr/local/lib/python3.9/site-packages/gevent/server.py", line 180, in init_socket
self.socket = self.get_listener(self.address, self.backlog, self.family)
File "/usr/local/lib/python3.9/site-packages/gevent/server.py", line 192, in get_listener
return _tcp_listener(address, backlog=backlog, reuse_addr=cls.reuse_addr, family=family)
File "/usr/local/lib/python3.9/site-packages/gevent/server.py", line 288, in _tcp_listener
sock.bind(address)
File "/usr/local/lib/python3.9/site-packages/gevent/_socketcommon.py", line 563, in bind
return self._sock.bind(address)
OSError: [Errno 98] Address already in use: ('172.19.0.3', 5599)
<raiwidgets.explanation_dashboard.ExplanationDashboard at 0x7f5f49b8c280>
ExplanationDashboard(global_explanation, model, dataset=X_test, true_y=y_test).
Interpret started at http://localhost:5004
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /tmp/ipykernel_209/4064676361.py in <module> ----> 1 ExplanationDashboard(global_explanation, model, dataset=X_test, true_y=y_test).__name__ AttributeError: 'ExplanationDashboard' object has no attribute '__name__'